﻿@model BrnMall.Web.StoreAdmin.Models.OrderListModel

@section header{
<title>订单列表-订单管理</title>
<link type="text/css" rel="stylesheet" href="/admin_store/css/site.css"/>
<script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
<script type="text/javascript" src="/admin_store/scripts/showlist.js"></script>
    <style>
        .logo { float:left; margin-right:5px;width:60px;height:60px;}
        .ship-type{border: 1px solid #ff8427;color: #555;border-radius: 2px;padding-left: 2px;padding-right: 2px;color: #ff8427;}
       
    </style>
}

@section body{
<h1 class="rightH1">
    微信小程序 &gt; 订单管理 &gt; <span class="rightH1-cur">订单列表</span> 
<div class="right">
    <a href="@Url.Action("exportorder")" class="menuBT">
        <img src="/admin_store/images/add.jpg" />导出订单
    </a>
<div class="clear"></div>
</div>
<div class="clear"></div>
</h1>
@using (Html.BeginForm("orderlist", "order"))
{
    
<div class="dataListSearch">
    <table height="32">
        <tbody class="col4">
            <tr>
                <td class="td1">订单编号：@Html.TextBox("OSN", Model.OSN, new { height = "18" })</td>
                <td class="td2">账号名称：@Html.TextBox("AccountName", Model.AccountName, new { height = "18" })</td>
                <td class="td3">收货人：@Html.TextBox("Consignee", Model.Consignee, new { height = "18" })</td>
                <td class="td4">订单状态：@Html.DropDownListFor(x => x.OrderState, Model.OrderStateList)</td>
                <td><input id="SearchOrder" name="SearchOrder" type="image" class="searchBut submit" src="/admin_store/images/s.jpg" /></td>
            </tr>
        </tbody>
    </table>
</div>

<div class="dataList">
<table width="100%">
<thead>
  <tr>
    <th align="left">订单商品</th>
    <th width="100" align="left">下单时间</th>
    <th width="140">收货人</th>
    <th width="80" align="left">订单金额</th>  
    <th width="80" align="left">实付款</th> 
    <th width="80" align="left">订单状态</th>  
    <th width="110" align="left">管理操作</th>
    </tr>
</thead>
  <tbody>
      
  @foreach (DataRow row in Model.OrderList.Rows)
  {
      <tr>
    <td>
        <img class="logo" src="@WorkContext.ImageCDN/upload/store/@{@row["StoreId"]}/product/show/source/@row["ShowImg"]"/>
        @if (row["regionid"].ToString().Equals("0"))
        {
            if (row["sid"].ToString().Trim() != "")
            {
                <span class="ship-type" title="订单是堂食">堂食</span>
            }
            else
            {
                <span class="ship-type" title="订单是自提方式">自提</span>
            }
        }
        <a href="@Url.Action("orderinfo",new { oid=row["oid"] })">@row["Name"]</a>
      </td>
    
    <td>@row["addtime"]</td>
    <td><div>@row["consignee"] @row["mobile"]</div><div>@row["provincename"] @row["cityname"] @row["countyname"]</div></td>
    <td>@row["orderamount"]</td>
    <td>
        @{var total= Convert.ToDecimal(row["PayCash"]) + Convert.ToDecimal(row["surplusmoney"]);}
        @total
      </td>
    <td>
        @switch ((OrderState)TypeHelper.ObjectToInt(row["orderstate"]))
        {
            case OrderState.WaitPaying:
            @:等待付款
            break;
            case OrderState.Confirming:
            @:待确认
            break;
            case OrderState.Confirmed:
            @:已确认
            break;
            case OrderState.PreProducting:
            @:备货中
            break;
            case OrderState.Sended:
            @:已发货
            break;
            case OrderState.Received:
            @:已收货
            break;
            case OrderState.Cancelled:
            @:取消
            break;
            case OrderState.Locked:
            @:锁定
            break;
            default:
            @:未知状态
            break;
        }
    </td>
      <td>
          @Html.ActionLink("详细信息", "orderinfo", new { oid = row["oid"] }, new { @class = "editOperate" })
          <span class="btn-line">|</span>
          @Html.ActionLink("打印", "printorder", new { oid = row["oid"] }, new { @class = "editOperate", target = "_blank" })<br />
          @Html.ActionLink("小票打印", "printconfig", new { oid = row["oid"] }, new { @class = "editOperate" })
      </td>
    </tr>
  }
</tbody>
</table>
</div>
<div class="dataListEdit">
<div class="page">
    @Html.StoreAdminPager(Model.PageModel)
</div>
</div>
}
}